﻿using System;
using System.Text;
using System.Collections.Generic;

namespace Model
{
    public class SimplificationSystem
    {
        public class Rule
        {
            private string text;
            public string Text
            {
                get { return text; }
            }
            private string replacement;
            public string Replacement
            {
                get { return replacement; }
            }

            public Rule(string text, string replacement)
            {
                this.text = text;
                this.replacement = replacement;
            }
        }

        private List<Rule> rules = new List<Rule>();
        public List<Rule> Rules
        {
            get { return rules; }
        }

        public string SimplifyText(string text)
        {
            foreach (Rule rule in rules)
            {
                text = text.Replace(rule.Text, rule.Replacement);
            }
            return text;
        }

        public void SimplifyBook(Book book)
        {
            if (book != null)
            {
                foreach (Verse verse in book.Verses)
                {
                    verse.Text = SimplifyText(verse.Text);
                }
            }
        }
    }
}
